package com.fromfuture.xuhuidoc.cordova.plugin;

import android.content.Intent;

import com.fromfuture.xuhuidoc.cordova.activity.SickRoomImageActivity;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by hp on 2017/7/20.
 */

public class GZImagePlugin extends CordovaPlugin {

    CallbackContext callbackContext_image;

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        try {
            if (action.equals("patchatwe_pic")){
                callbackContext_image=callbackContext;
                JSONObject jsonObject=args.getJSONObject(0);

                String pic_url=jsonObject.getString("Pic_url");
                String pic_name=jsonObject.getString("Pic_name");
                Intent intent=new Intent(cordova.getActivity(), SickRoomImageActivity.class);
                intent.putExtra("pic_url",pic_url);
                intent.putExtra("pic_name",pic_name);
                cordova.getActivity().startActivity(intent);

            }
        }catch (Exception e){
            return false;
        }
        return false;
    }

}
